from django.db import models

choice = (
    (0, '未充值'),
    (1, '已充值')
)

choice1 = (
    (0, '收入'),
    (1, '支出')
)


# Create your models here.
class User(models.Model):
    phone = models.CharField('电话号码', max_length=11, unique=True)
    code = models.CharField('验证码', max_length=10)
    flags = models.IntegerField(choices=choice, default=0)
    create_time = models.DateTimeField('创建时间', auto_now_add=True)
    update_time = models.DateTimeField('更新时间', auto_now=True)


class AiqiyiVideo(models.Model):
    kind = models.CharField('种类', max_length=30)
    sellNum = models.IntegerField('出售数量')
    price = models.FloatField('单价', max_length=5)
    total_price = models.FloatField('总价', max_length=10)
    cost = models.FloatField('成本', max_length=10)
    profit = models.FloatField('盈利', max_length=10)
    datatime = models.DateTimeField('创建时间', auto_now_add=True)


class TencentVideo(models.Model):
    kind = models.CharField('种类', max_length=40)
    sellNum = models.IntegerField('出售数量')
    price = models.FloatField('单价', max_length=5)
    total_price = models.FloatField('总价', max_length=10)
    cost = models.FloatField('成本', max_length=10)
    profit = models.FloatField('盈利', max_length=10)
    datatime = models.DateTimeField('创建时间', auto_now_add=True)


class Cost(models.Model):
    time = models.DateTimeField('创建时间', auto_now_add=True)
    kind = models.CharField('种类', max_length=30)
    price = models.FloatField('单价', max_length=5)
    number = models.IntegerField('数量')
    goods = models.CharField('商品', max_length=50)
    total_price = models.FloatField('总价', max_length=10)
    iuput_or_output = models.IntegerField(choices=choice1, default=0)
    balance = models.FloatField('余额', max_length=10)
    note = models.CharField('备注', max_length=100)


class Access_token(models.Model):
    token = models.CharField('兑换码', max_length=100)
